#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define MAXLEN 102

int
main (void)
{
	int k = 0;
	int str_len = 0, word_len = 0;
	unsigned char firstline = true, firstword = true; // bool
	char word[MAXLEN];
	freopen("format.in", "r", stdin);
	freopen("format.out","w",stdout);

	scanf("%d\n", &k);
	while (scanf("%s", word) == 1) { // <something>
		word_len = strlen(word);
		if (str_len + 1 + word_len > k) {
			if (!firstline || !firstword)
				printf("\n");
			str_len = 0;
			firstline = false;
			firstword = false;
		} else {
			if (firstword) {
				//str_len += printf(" ");
				firstword = false;
			} else {
				str_len += printf(" "); // else (firstword)
			}
		}
		str_len += printf("%s", word);
#ifdef DEBUG
		fprintf(stderr, "\tword = \"%s\";\t\tstr_len = %d; F = %d;\n", word, str_len, F);
#endif
	}
	if (str_len != 0)
		printf("\n");

	return 0;
}
